{extend name="public/layout" /}
{block name="title"}用户注册{/block}
{block name="head"}
<style>
    body{background:#f4f4f4;}
    .weui-cells:after{border: none;}
    .weui-cell{background: #fff;margin-bottom: 15px;border-radius: 10px;}
    .weui-cells{background:#f4f4f4;}
</style>
{/block}
{block name="body"}
<h1 style="text-align:center;font-size:18px;height：55px;line-height: 55px;font-weight: 500;">用户注册</h1>
<div class="enroll-box">
    <form method="post" class="form-horizontal" id="form">
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">您的姓名</label></div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" name="member_name" value="" placeholder="请输入您的姓名">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">手机号码</label>
                </div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="tel" name="member_mobile" id="mobile" value="" placeholder="请输入手机号">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                </div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="password" name="member_pass" placeholder="请输入密码">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">确认密码</label>
                </div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="password" name="member_pass_ng" placeholder="请再次输入密码">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">短信验证</label></div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="number" name="vcode" placeholder="请输入验证码">
                </div>
                <div class="weui-cell__ft">
                    <a class="weui-vcode-btn weui-btn_disabled" href="javascript:;"
                       onclick="sendSms()">获取验证码</a>
                </div>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">企业名称</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="company_name" id="company_name" placeholder="请输入企业名称">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">职务</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="member_duties" id="member_duties" placeholder="请输入职务">
            </div>
        </div>
        <div class="weui_btn_area" style="padding:20px 0;">
            <div id="validError"></div>
            <button class="weui-btn weui-btn_primary" type="submit" style="background:#f60" id="btnSub">注册</button>
        </div>
        <a href="{:url('userLogin')}" style="float: right;margin-right: 15px;color: blue;">已有账号，去登陆</a>
    </form>
</div>

{/block}
{block name="js"}
<script src="/public/plugins/in/in-min.js"></script>
<script src="/public/plugins/in/in-config.js"></script>
<script src="/public/system/js/common.js"></script>
<script type="text/javascript">
    $(function () {
        iCheck();
        ajaxSubForm('#btnSub',function (res) {
                location.href=res.url;
        });
    });
    function sendSms(){
        var mobile = $('#mobile').val();
        if(mobile == 'null'){
            alert('请先属入手机号');
        }else{
            $.post("{:url('sendSms')}",{mobile: mobile},function(res){
                alert(res.msg);
            })
        }
    }
    $('#company_name').change(function () {
        var company_name=$(this).val();
        $.post('{:url("isCompany")}',{'company_name':company_name},function (res) {
            if (!res.code){
                layer.open({
                    title:'企业名称未知'
                    ,content: '您的企业尚未在本平台注册,请检查是否正确，如果继续申请,我们的工作人员有可能联系您补全公司信息'
                    ,btn: '我知道了'
                });
            }
        })
    })
</script>
{/block}


            
